diff options
Diffstat (limited to 'examples/docs/src/pages/[...slug].astro')
-rw-r--r-- | examples/docs/src/pages/[...slug].astro | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/docs/src/pages/[...slug].astro b/examples/docs/src/pages/[...slug].astro new file mode 100644 index 000000000..a59e4bc2a --- /dev/null +++ b/examples/docs/src/pages/[...slug].astro @@ -0,0 +1,22 @@ +--- +import { CollectionEntry, getCollection } from 'astro:content'; +import MainLayout from '../layouts/MainLayout.astro'; + +export async function getStaticPaths() { + const docs = await getCollection('docs'); + return docs.map((entry) => ({ + params: { + slug: entry.slug, + }, + props: entry, + })); +} +type Props = CollectionEntry<'docs'>; + +const post = Astro.props; +const { Content, headings } = await post.render(); +--- + +<MainLayout headings={headings} {...post.data}> + <Content /> +</MainLayout> |